export default function(sequelize, DataTypes) {
  return sequelize.define('depot', {
    id: {
      autoIncrement: true,
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键id"
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: "物品名称"
    },
    unit: {
      type: DataTypes.DECIMAL(20,2),
      allowNull: false,
      comment: "物品价格"
    },
    amount: {
      type: DataTypes.DECIMAL(20,2),
      allowNull: false,
      defaultValue: 1.00,
      comment: "物品数量"
    },
    cost: {
      type: DataTypes.DECIMAL(20,2),
      allowNull: true,
      comment: "物品成本"
    },
    raw_material: {
      type: DataTypes.TINYINT,
      allowNull: true,
      comment: "是否原材料 0不是 1是"
    },
    company_id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      comment: "所属公司id"
    },
    is_delete: {
      type: DataTypes.TINYINT,
      allowNull: true,
      comment: "逻辑删除 0没有 1删除"
    }
  }, {
    sequelize,
    tableName: 'depot',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
